package p270jp.pxv.android.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.GridLayoutManager;
import java.util.Objects;
import p014ae.AbstractActivityC0141q2;
import p014ae.C0185y;
import p045be.PopularLiveAdapter;
import p047bg.C1124a;
import p071cd.Functions;
import p090d0.C2518n;
import p134ei.AnalyticsScreenName;
import p165fo.C3114c;
import p165fo.Subscribe;
import p187gl.PixivRequest;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.UpdateMuteEvent;
import p270jp.pxv.android.model.ContentRecyclerViewState;
import p270jp.pxv.android.model.ResponseAttacher;
import p270jp.pxv.android.model.SketchLiveListType;
import p270jp.pxv.android.view.ContentRecyclerView;
import p314lg.ActivityLiveListBinding;
import p347mm.ContentRecyclerViewBehavior;
import p347mm.DefaultContentRecyclerViewBehavior;
import p451qm.PopularLiveListItemDecoration;
import p484s6.C5998s;
import p517td.BehaviorSubject;
import p607x0.C7050l;
import p639y6.C7296l;
import p665z6.C7461p;
import p665z6.C7469x;
import p677zi.PixivImageLoader;

/* renamed from: jp.pxv.android.activity.PopularLiveListActivity */
/* loaded from: classes2.dex */
public class PopularLiveListActivity extends AbstractActivityC0141q2 {

    /* renamed from: f0 */
    public static final /* synthetic */ int f18529f0;

    /* renamed from: b0 */
    public ContentRecyclerViewBehavior f18530b0;

    /* renamed from: c0 */
    public ActivityLiveListBinding f18531c0;

    /* renamed from: d0 */
    public PopularLiveAdapter f18532d0;

    /* renamed from: e0 */
    public final PixivImageLoader f18533e0 = (PixivImageLoader) C2518n.m7641d(PixivImageLoader.class);

    /* renamed from: jp.pxv.android.activity.PopularLiveListActivity$a */
    /* loaded from: classes2.dex */
    public class C4064a extends GridLayoutManager.AbstractC0780c {
        public C4064a(PopularLiveListActivity popularLiveListActivity) {
        }

        @Override // androidx.recyclerview.widget.GridLayoutManager.AbstractC0780c
        /* renamed from: c */
        public int mo1424c(int i) {
            return i == 0 ? 2 : 1;
        }
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    @SuppressLint({"RxJava2SubscribeMissingOnError"})
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        C3114c.m6284b().m6276j(this);
        ActivityLiveListBinding rVar = (ActivityLiveListBinding) DataBindingUtil.m11369d(this, R.layout.activity_live_list);
        this.f18531c0 = rVar;
        C1124a.m10196R(this, rVar.f22171u, getString(R.string.popular_lives));
        ResponseAttacher responseAttacher = new ResponseAttacher(C7469x.f31309g, new C7296l(this, 8), new C7461p(this, 10));
        responseAttacher.setFilterItemsCallback(C5998s.f26026k);
        ContentRecyclerView contentRecyclerView = this.f18531c0.f22169s;
        contentRecyclerView.f19470J0 = new C7050l(PixivRequest.m5809h(SketchLiveListType.POPULAR));
        contentRecyclerView.f19471K0 = responseAttacher;
        contentRecyclerView.m4509v0();
        ActivityLiveListBinding rVar2 = this.f18531c0;
        this.f18530b0 = new DefaultContentRecyclerViewBehavior(rVar2.f22169s, rVar2.f22168r, rVar2.f22170t, false);
        BehaviorSubject<ContentRecyclerViewState> state = this.f18531c0.f22169s.getState();
        ContentRecyclerViewBehavior fVar = this.f18530b0;
        Objects.requireNonNull(fVar);
        state.m984q(new C0185y(fVar, 4), Functions.f5388e, Functions.f5386c, Functions.f5387d);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
        gridLayoutManager.f3458K = new C4064a(this);
        PopularLiveListItemDecoration iVar = new PopularLiveListItemDecoration(this);
        int r = C1124a.m10174r(this);
        int i = iVar.f25473a;
        int i2 = ((r / 2) - i) - iVar.f25474b;
        this.f18532d0 = new PopularLiveAdapter(i2, r - (i * 2), i2, this.f18533e0);
        this.f18531c0.f22169s.setLayoutManager(gridLayoutManager);
        this.f18531c0.f22169s.m10871g(iVar);
        this.f18531c0.f22169s.setAdapter(this.f18532d0);
        this.f18531c0.f22169s.m4506y0();
        this.f18757A.m6525e(AnalyticsScreenName.RECOMMENDED_LIVE);
    }

    @Override // p014ae.AdActivity, p270jp.pxv.android.activity.BaseActivity, p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        C3114c.m6284b().m6274l(this);
        this.f18530b0.mo3535a();
        super.onDestroy();
    }

    @Subscribe
    public void onEvent(UpdateMuteEvent updateMuteEvent) {
        if (this.f18531c0.f22169s.getAdapter() != null) {
            this.f18531c0.f22169s.getAdapter().f3606a.m10780b();
        }
    }
}
